<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<%@ page contentType="text/html; charset=utf-8"%>
	<%@ include file="/commons/taglibs.jsp"%>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
		<title>信息机管理</title>

		<%@ include file="/commons/css_js_head.jsp"%>


		<script type="text/javascript">
//复写Url
doListUrl = "${ctx }/plat/platMcInfoAction!doList.ts";
doViewBeforeUrl = "${ctx }/plat/platMcInfoAction!doView.ts";
//添加之前
function doAddBefore() {
	var _form = document.forms[0];
	if (doAddBeforeUrl == '') {
		alert('请设置正确的URL!');
		return false;
	}

	_form.action = doAddBeforeUrl;
	_form.submit();
}

//更新之前 
function doViewBefore(theId) {
	var _form = document.forms[0];
	if (doViewBeforeUrl == '') {
		alert('请设置正确的URL!');
		return false;
	}
	tb_show("update","${ctx }/plat/platMcInfoAction!doView.ts?theId="+ theId+"&keepThis=true&TB_iframe=true&width=700&height=670&modal=true",false);
}

//更新之前 
function doUpdateConfBefore(mcInfoId) {
	var _form = document.forms[0];
	if (doViewBeforeUrl == '') {
		alert('请设置正确的URL!');
		return false;
	}
	tb_show("update","${ctx }/plat/platMconfAction!doToUpdate.ts?mcInfoId="+ mcInfoId+"&keepThis=true&TB_iframe=true&width=700&height=400&modal=true",false);
}

//更新之前 
function doAddConfBefore(mcInfoId) {
	var _form = document.forms[0];
	if (doViewBeforeUrl == '') {
		alert('请设置正确的URL!');
		return false;
	}
	tb_show("Add","${ctx }/plat/platMconfAction!doAdd.ts?mcInfoId="+ mcInfoId+"&keepThis=true&TB_iframe=true&width=700&height=400&modal=true",false);
}

function doAllUpdateConfBefore(){
    var _form = document.forms[0];
    var mcInfoId="";
	if (doViewBeforeUrl == '') {
		alert('请设置正确的URL!');
		return false;
	}
	var cb = document.getElementsByName("checkbox");
    for(i=0;i<cb.length;i++){
      if (cb[i].checked){
        mcInfoId=mcInfoId+ cb[i].value+","
      }
    }
	tb_show("Allupdate","${ctx }/plat/platMconfAction!doAdd.ts?mcInfoId="+mcInfoId +"&keepThis=true&TB_iframe=true&width=700&height=400&modal=true",false);
}


//关闭小窗口
function onCancel()
{
	closeWindow();
}
function closeWindow()
{
	self.parent.tb_remove();
}



//选取所有的checkbox控件
  checkit  =  true;    
  function   SelectAll()  {
   var checkbox = document.getElementsByName("checkbox");      
      if (checkit)      
      {      
      for(i=0;i<checkbox.length;i++)
      
        checkbox.item(i).checked=true;   
        checkit = false;      
      }      
      else      
      {      
      for(i=0;i<checkbox.length;i++)      
        checkbox.item(i).checked=false;      
        checkit = true;      
      }      
}

</script>


	</head>
	<body style="overflow-x: hidden">

		<!-- 标题 -->
		<div class="mTitle">
			<span class="hidsearch"><a href="javascript:void(0)"
				onClick="return chg('searchList');" id="ImgArrow"> <img
						src="${ctx}/images/icon_up.gif" id="imgButton" />
			</a> </span>
			<b class="bbig">信息机管理</b>
		</div>

		<!--list -->
		<div class="searchBar" id="searchList" style="display: block;">
			<form action="/plat/platMcInfoAction!doList.ts" method="post">
				<table class="searchTable">
					<tr>
						<th>
							信息机编号：
						</th>
						<td>
							<s:textfield name="mcId" theme="simple"></s:textfield>
						</td>
							<th>
							是否上线
						</th>
						<td>
							 <s:select list="#{1:'是',0:'否'}"  
							theme="simple"
							name="status"
							listKey="key" 
							cssStyle="width:50px;"	
							listValue="value"  
							value="1"
							/> 
						</td>
						<th>
							是否配置
						</th>
						<td>
							 <s:select list="#{1:'是',0:'否'}"  
							theme="simple"
							name="conf"
							listKey="key" 
							cssStyle="width:50px;"	
							listValue="value"  
							value="1"
							/> 
						</td>
						
						<td>
							<input name="btn_query" type="button" class="btn" value="查询"
								onclick="doQuery();" />
							
						</td>
					</tr>
				</table>
			</form>
		</div>
		<div class="mainList">

			<table class="listTable">
				<tr>
					<th>序号</th>
					<th> <input type="checkbox" name="all" onclick="SelectAll()" />批量操作</th>
					<th>
						信息机编号
					</th>
					<th>
						是否配置
					</th>
					<th>
						更新时间
					</th>
					<th>
						是否正常
					</th>
					
					<th>
						操作
					</th>
					
				</tr>

				<c:forEach var="mcInfo" varStatus="status" items="${pager.data}">
					<tr align=center>
						<td>${status.index+1} </td>
						<td><input type="checkbox" name="checkbox" value="${mcInfo.theId}" /> </td>
							<td>
							${mcInfo.mcId}
						</td>
						<td>
						 <c:if test="${mcInfo.conf == '1'}">  <spand>是</spand> </c:if>
						 <c:if test="${mcInfo.conf == '0'}">  <spand><font color="red">否</font></spand> </c:if>
						</td>
						<td>
							${mcInfo.updateTime}
						</td>
						
						<td>
						 <c:if test="${mcInfo.status == '1'}">  <spand>是</spand> </c:if>
						 <c:if test="${mcInfo.status == '0'}">  <spand><font color="red">否</font></spand> </c:if>
						</td>
						
						<td>
							<a href="javascript:void(0)"
								onclick="javascript:doViewBefore('${mcInfo.theId}' );"><span
								class="icon_edit">&nbsp;</span>查看详情</a>
								
							<c:if test="${mcInfo.conf == '1'}">  
							   <a href="javascript:void(0)"
								onclick="javascript:doUpdateConfBefore('${mcInfo.theId}' );"><span
								class="icon_edit">&nbsp;</span>修改配置</a>
							</c:if>
						 <c:if test="${mcInfo.conf == '0'}">  
						       <a href="javascript:void(0)"
								onclick="javascript:doAddConfBefore('${mcInfo.theId}' );"><span
								class="icon_edit">&nbsp;</span>新增配置</a>
						 </c:if>
						</td>
					</tr>
				</c:forEach>
			</table>
		</div>
		<a href="javascript:void(0)"
								onclick="javascript:doAllUpdateConfBefore();"><span
								class="icon_edit">&nbsp;</span>批量修改配置</a>
		<!--end list -->

		<!-- 分页区域  -->
<%@ include file="/page/pager.jsp"%>

<script type="text/javascript">
ajaxAnywhere.formName = "form1";
ajaxAnywhere.getZonesToReload = function() {
    return "zoneList";
}
</script>

	</body>
</html>
